﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace BKH.BLL
{
    class ChiTietDonThuocBUO:IBUO<tbl_ChiTietDonThuoc>
    {
        HospitalDBDataContext context = new HospitalDBDataContext();
        public bool Insert(tbl_ChiTietDonThuoc obj)
        {
            try
            {
                context.tbl_ChiTietDonThuocs.InsertOnSubmit(obj);
                context.SubmitChanges();
                return true;
            }
            catch (Exception)
            {
                
                return false;
            }
        }

        public bool Delete(int id)
        {
            throw new NotImplementedException();
        }

        public bool Delete(tbl_ChiTietDonThuoc obj)
        {
            throw new NotImplementedException();
        }

        public List<tbl_ChiTietDonThuoc> GetAll()
        {
            return context.tbl_ChiTietDonThuocs.ToList<tbl_ChiTietDonThuoc>();
        }

        public tbl_ChiTietDonThuoc GetSingle(int id)
        {
            //return context.tbl_ChiTietDonThuocs.Where(n => n.ThuocID == id).ToList<tbl_ChiTietDonThuoc>().FirstOrDefault();
            throw new NotImplementedException();
        }

        public bool Update(int id, tbl_ChiTietDonThuoc obj)
        {
            throw new NotImplementedException();
        }

        //public tbl_ChiTietDonThuoc KTraThuocIDTrongBB(int thuocID, int donThuocID)
        //{
        //    return context.tbl_ChiTietDonThuocs.Where(n => n.ThuocID == thuocID && n.DonThuocID == donThuocID).ToList<tbl_ChiTietDonThuoc>();
        //}
    }
}
